/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package nsip.model;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;

/**
 * Represents a list of RFQs which have been selected as feasible by the
 * production. This list can be rated by a number of components.
 *
 * @author nico.rehwaldt
 */
public class RFQSet implements Iterable<Item> {
    
    private final Collection<Item> rfqs;
    private List<Double> ratings = new ArrayList(10);

    private double aggregatedRating = -1;
    
    /**
     * Creates an rfqset from the given collection of rfqs.
     * 
     * @param rfqs
     */
    public RFQSet(Collection<Item> rfqs) {
        this.rfqs = rfqs;
    }

    /**
     * @return the rfqs
     */
    public Collection<Item> getRFQs() {
        return rfqs;
    }

    /**
     * @return the ratings
     */
    public List<Double> getRatings() {
        return ratings;
    }

    /**
     * Add a rating to this rfq set
     * @param rating
     */
    public void addRating(double rating) {
        this.ratings.add(rating);
    }

    /**
     * Return the aggregated rating for this rfq set
     * @return
     */
    public Double getAggregatedRating() {
        return aggregatedRating;
    }

    /**
     * Sets the aggregated rating for this rfq set
     * @param rating
     */
    public void setAggregatedRating(double rating) {
        this.aggregatedRating = rating;
    }

    /**
     * {@inheritDoc }
     */
    public Iterator<Item> iterator() {
        return rfqs.iterator();
    }
}
